
$(function () {
	var id=localStorage.id;
	vm.workOrderInfo(id);
	vm.workOrderContentInfo(id);
	
	
});

var vm = new Vue({
	el:'#rrapp',
	data:{
		cexWorkOrder: {},
		cexWorkOrderContents:[],
		cexWorkOrderContent:{},
	},
	methods: {
		workOrderInfo:function(id){
			
			$.ajax({
				async : false,
				type: "POST",
			    url: baseURL +"tworkorder/oneInfo/"+id,
			    datatype:"json",
			    success: function(r){
			    	
					if(r.code == 0){
						vm.cexWorkOrder=r.tWorkOrderEntity;
					}else{
//						alert(r.msg);
					}
				}
			});
		},
		workOrderContentInfo:function(id){
			$.ajax({
				type: "POST",
			    url: baseURL +"tworkordercontent/ListByWorkOrderId/"+id,
			    dataType : "json",
			    success: function(r){
					if(r.code == 0){
					
						vm.cexWorkOrderContents=r.tWorkOrderContentEntity;
						
					}else{
//						alert(r.msg);
					}
				}
			});
		},
		saveworkOrderContentAdmin:function(){

			alert(vm.cexWorkOrder.id);
			vm.cexWorkOrderContent.cexWorkOrderId=vm.cexWorkOrder.id;
			if (vm.cexWorkOrderContent.content==null||vm.cexWorkOrderContent.content=="") {
				alert("请填写补充问题");
			} else {
				$.ajax({
					type : "POST",
					url :baseURL +"tworkordercontent/saveAdmin",
					contentType : "application/json",
					data : JSON.stringify(vm.cexWorkOrderContent),
					success : function(r) {
						if (r.code === 0) {
							window.location.reload();
							} else {
							alert(r.msg);
						}
					}
				});
			}
			
		
		},

	}
});